﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BLL;
using DAL;

namespace PhongMachTu.GUI
{
    public partial class frmHoaDon : Form
    {
        public frmHoaDon()
        {
            InitializeComponent();
            cbMaBenhNhan.DataSource = bllBenhNhan.LayDSBenhNhan();
            cbMaBenhNhan.DisplayMember = "HoTen";
            cbMaBenhNhan.ValueMember = "MaBenhNhan";
        }
        BenhNhanBLL bllBenhNhan = new BenhNhanBLL();
        ChiTietKhamBenhBLL bllCTKhamBenh = new ChiTietKhamBenhBLL();
        ThamSoBLL bllThamSo = new ThamSoBLL();
        int tienthuoc = 0;
        int tienKham = 0;
        int tongTien = 0;
        private void frmHoaDon_Load(object sender, EventArgs e)
        {
            tienthuoc = bllCTKhamBenh.tinhTienThuoc(maKhamBenh);
            tienKham = bllThamSo.TienKham();
            tongTien = tienthuoc + tienKham;

            txtTienThuoc.Text = string.Format("{0:0,00 VNĐ}", tienthuoc);
            txtTienKham.Text = string.Format("{0:0,00 VNĐ}", tienKham);
            txtTongTien.Text = string.Format("{0:0,00 VNĐ}", tongTien);

            cbMaBenhNhan.SelectedValue = MaBenhNhan;
        }
        public int MaBenhNhan;
        public int maKhamBenh;
        private void bnt_laphoadon_Click(object sender, EventArgs e)
        {
            


        }

        private void button1_Click(object sender, EventArgs e)
        {
            Report.frmHoaDonThanhToan frm = new Report.frmHoaDonThanhToan();
            frm.maKhamBenh = maKhamBenh;
            frm.ShowDialog();
        }


    }
}
